package com.demo.rbactest.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 登录成功返回的结果类(登录返回的结果中多一个token属性)
 */

@AllArgsConstructor
@NoArgsConstructor
@Data
public class LoginR {
    //    状态码
    private Integer code;
    //    状态
    private String status;
    //    返回数据
    private Object data;
    //    返回token
    private String token;


    public LoginR(Integer code, String status, Object data) {
        this.code = code;
        this.status = status;
        this.data = data;
    }

    //    返回成功结果(带token)
    public static LoginR success(Object data, String token) {
        return new LoginR(0, "成功", data, token);
    }

    //    返回失败结果
    public static LoginR error(Object data) {
        return new LoginR(-1, "失败", data);
    }

}
